<!DOCTYPE HTML>
<html lang="de">
    <head>
        <title>Hyphenator.js &ndash; Test 44</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <style type="text/css">
            body {
                width:50%;
                margin-left:25%;
                margin-right:25%;
            }
            #test {
            	background-color: #ffd6d6;
            }
            #ref1 {
            	display: none;
            }
            #ref2 {
            	background-color: #d6ffd6;
            }
        </style>
        <script src="files/jquery.js" type="text/javascript"></script>
    </head>
    <body>
		<p><a href="index.html">&lt;&lt; index</a> | <a href="test43.html">&lt;- Prev</a> | <a href="test45.html">Next -&gt;</a></p>
		<h1>Test 44</h1>
        <p id="desc">Hyphenating content that has been loaded by AJAX.</p>

		<form method="post" action="#">
		<input id="btn" type="button" value="load text…" onclick="insert()">
		</form>

        <p id="test" class="hyphenate">Silbentrennung</p>
        <p id="ref1">Sil|ben|tren|nung</p>
        <p id="ref2">Das eng|li|sche Wort <span lang="en">&ldquo;Hy|phen|ation&rdquo;</span> lässt sich nicht un|be|dingt wört|lich mit «Sil|ben|tren|nung» über|set|zen.</p>
        <script src="../Hyphenator.js" type="text/javascript"></script>
        <script type="text/javascript">
        	var r = true;
            function insert()  {
 			    $("#test").load("files/test44inc.html", function() {
 			    	Hyphenator.run();
					if (parent != window) {
						window.setTimeout(function () {
							var t1 = document.getElementById('test').innerHTML,
							t2 = document.getElementById('ref2').innerHTML,
							desc = document.getElementById('desc').firstChild.data,
							msg = {
								desc: desc,
								index: 44
							};
							r = (t1 == t2);

							if (r) {
								msg.result = 'passed';
							} else {
								msg.result = 'failed';
							}
							parent.postMessage(JSON.stringify(msg), window.location.href);
						}, 500);     	
					}
 			    });
			}
			
			Hyphenator.run({
				wordhyphenchar: '|'
			});
			
        	if (parent != window) {
				window.setTimeout(function () {
					var t1 = document.getElementById('test').innerHTML,
					t2 = document.getElementById('ref1').innerHTML,
					
					r = (t1 == t2);

					$('#btn').click();
				}, 500);     	
			}
        </script>
    </body>
</html>